<!DOCTYPE html>
<meta charset="utf-8">
<title>User file selection</title>
<link rel=help href="https://html.spec.whatwg.org/#file-upload-state-(type=file)">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/file-drag-common.js"></script>
<body>
<script>
"use strict";

test(() => {
  const input = document.createElement("input");
  input.type = "file";
  document.body.appendChild(input);
  const events = [];

  input.addEventListener("change", () => {
    events.push("change");
  });
  input.addEventListener("input", () => {
    events.push("input");
  });

  if (window.eventSender) {
    dragFilesOntoElement(input, ['foo.txt']);
    assert_array_equals(events, ["input", "change"]);
  }

}, "a file input emits input, change events in order after selected files");
</script>